package com.nefu.huiyi.repository;

import com.nefu.huiyi.entity.DepartmentStatsMarker;
import com.nefu.huiyi.dto.DepartmentStatsDTO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;

public interface DepartmentStatsRepository extends JpaRepository<DepartmentStatsMarker, Long> {

    @Query(nativeQuery = true,
            value = "SELECT department as departmentName, COUNT(*) as doctorCount " +
                    "FROM doctor GROUP BY department")
    List<DepartmentStatsDTO> countDoctorsByDepartment();
}